<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
	</head>
	<link rel="stylesheet" href="css/2.css" />
	<script>
	         
	    	 var isPEWOk=false;
	         var isNameOk=false;
		function focusObj(id) {
	    	id.style.backgroundColor="#FFCC80"
	        }
		function blurUser (id) {
	    	 var user=id.value;
	    	 if (user=="") {
	    	 	userDiv.innerHTML="账号不能为空"
	    	 	return false;
	    	 }
	    	 for (var i=0;i<user.length;i++) {
	    	 	var j=user.substring(i,i+1)
	    	 if (j==" ") {
	    	 	userDiv.innerHTML="账号不能包含空格"
	    	 	return false}
	    	 }
	    	 id.style.backgroundColor="#FFF"
	    	 userDiv.innerHTML=""
	    	 isNameOk=true
	    	 return true;
	    }
		function blurPwd (id) {
	    	 var pwd=id.value;
	    	 var pwdDiv=document.getElementById("pwdDiv")
	    	 if (pwd=="") {
	    	 	pwdDiv.innerHTML="密码不能为空"
	    	 	return false;
	    	 }
	    	 if (pwd.length<6) {
	    	 	pwdDiv.innerHTML="密码长度不能少于6位"
	    	 	returnfalse
	    	 }
	    	 id.style.backgroundColor="#FFF"
	    	 pwdDiv.innerHTML=""
	    	 isPEWOk=true;
	    	 return true;
	    }
			function isReady () {
	    	//如果所有控件都验证通过，则允许提交
	    	if(isNameOk&&isPEWOk)
	    	{
	    		return true;
	    	}
	    	else{
	    		return false;
	    	}
	   }
			}
	</script>
	<body background="img/2.jpg">
		<div id="container">
		<form action="3.html" method="post" name="denglu">
			<div id="body">
				<div id="top">
					<div id="topleft" style="color: white;"><a href="登录页面.html">管理员登录</a></div>
					<div id="topright" style="color: white;"><a href="用户页面.html">用户登录</a></div>
				</div>
		    <div id="header">
					<p align="left"><b>账号密码登陆</b></p>
				</div>
				<br>
				<div id="content">
					账号:<input type="text" name="zh" id="zh" onfocus="focusObj(this)" onblur="blurUser(this)"/><div id="userDiv"></div>
					<br>
					密码:<input type="password" name="mm" id="mm" onfocus="focusObj(this)" onblur="blurPwd(this)"/><div id="pwdDiv"></div>
					<br>
					验证码：<img src="img/1.jpg" width="35px" height="30px"><a href="#" style="font-size: smaller;">看不清？换一个</a>
					<br>
					<input type="checkbox" name="zd" id="zd" value="下次自动登录" size="1" checked="checked"><font size="1">下次自动登录</font>
					<br>
					<input type="submit" name="dl" id="dl" value="登录" size="7" width="50%" height="10px" onclick="return isReady()" onsubmit="return isReady()"/>
					<br>
					<p align="center"><font size="2"><a href="#">忘记密码？</a>|<a href="3.html">注册新账号</a>|<a href="#">意见反馈</a></font></p>
				</div>
			</div>
		</div>
		</form>
	</body>
</html>
